import os

import requests
from Base.basePath import BasePath as BP

url = 'http://192.168.195.148/bit-perfinsights-web/api/v02/account/down-template'
filepath = os.path.join(BP.DATA_DRIVER_DIR, 'vip模板下载1.xls')

headers = {
            "Authorization":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJCSVQtTVNBIiwiaWF0IjoxNjUwNTExMDMzLCJuYmYiOjE2NTA1MDk4MzMsImV4cCI6IjI2NDEzODA2ODQiLCJjb25zdW1lciI6IkJJVC1NU0EiLCJ0eXBlIjoidXNlciIsImlkIjoicm9vdCIsIm5hbWUiOiIiLCJ0ZW5hbnRJZCI6ImFkbWluIn0.U1-giqVnX1o8xrFVoORmJOW2cW_Fwa6xr6AxA560FaY"
        }
r = requests.post(url, headers=headers) #通过files参数来传递file数据
print(r.text)
res_con = r.content
with open(filepath,'wb') as f:
    f.write(res_con)
